package com.ruoyi.project.monitor.job.task;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ruoyi.common.utils.DL4JUtils;
import com.ruoyi.common.utils.LireUtil;
import com.ruoyi.project.system.picture.domain.Picture;
import com.ruoyi.project.system.picture.service.IPictureService;

/**
 * 定时任务调度测试
 * 
 * @author ruoyi
 */
@Component("ryTask")
public class RyTask
{
	@Autowired
    private IPictureService pictureService;

    public void ryParams(String params)
    {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams()
    {
        System.out.println("执行无参方法");
    }
    
    public void indexImage()
    {
        System.out.println("执行创建索引方法");
        LireUtil.index(pictureService.selectPictureAll());
    }
    
    public void predictImage() throws IOException
    {
        System.out.println("执行图片识别方法");
        List<Picture> pictures = DL4JUtils.useModelPredict(pictureService.selectPictureAll());
        for(Picture picture:pictures) {
        	pictureService.updatePicture(picture);
        }
        
    }
    
}
